<template>
  <div id="demo">
    <button v-on:click="show = !show">
      Toggle
    </button>
    <!-- 给显示/隐藏的标签添加一些特定类名  -->
    <transition name="fade">
      <div class="box" v-show="show"></div>
    </transition>
    
  </div>
</template>

<script>
export default {
  name: 'App',
  data () {
    return {
      show: true
    }
  }
}
</script>

<style scoped>
.box {
  height: 100px;
  width: 100px;
  background: pink;
}
/* 指定过渡的样式 */
.fade-enter-active {
  transition: all 1s;
}
.fade-leave-active {
  transition: all 3s;
}

/* 指定隐藏时的样式 */
.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
  opacity: 0;
  transform: translateX(30px);
}
</style>
